package com.project.m.api.busi.db.service.hicatcard.distributor;

import com.project.m.api.busi.db.entity.hicatcard.distributor.TDistributorPerson;
import com.project.m.api.busi.db.repo.distributor.DistributorPersonRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class DistributorPersonService {

    @Autowired
    DistributorPersonRepo distributorPersonRepo;

    @Transactional(readOnly = true)
    public List<TDistributorPerson> findByUserIdAndEnableOrderByCreateTimeDesc(Long userId, Boolean enable) {
        return distributorPersonRepo.findByUserIdAndEnableOrderByCreateTimeDesc(userId, enable);
    }

    public void saveDistributorPerson(TDistributorPerson distributorPerson) {
        distributorPersonRepo.save(distributorPerson);
    }
}
